package com.journey.org.app

import com.journey.org.entity.*
import com.mvvmhabit.org.http.TianXingResponse
import kotlinx.coroutines.Deferred
import retrofit2.http.*

interface API {

    // 登录
    @FormUrlEncoded
    @POST("/journey-auth/oauth/token")
    fun loginAsync(@FieldMap(encoded = true) paramMap: Map<String, @JvmSuppressWildcards Any>): @JvmSuppressWildcards Deferred<LoginEntity>

    // 获取文章列表
    @GET("/journey-work/api.admin/v1/article/list")
    fun loadArticleListAsync(@QueryMap(encoded = true) paramMap: Map<String, @JvmSuppressWildcards Any>): @JvmSuppressWildcards Deferred<BaseResponse<List<ArticleEntity>>>

    // 获取收藏列表
    @GET("/journey-work/api.admin/v1/collection/list")
    fun loadCollectionListAsync(@QueryMap(encoded = true) paramMap: Map<String, @JvmSuppressWildcards Any>): @JvmSuppressWildcards Deferred<BaseResponse<List<MineCollectionEntity>>>

    // 获取收藏列表
    @GET("/journey-work/api.admin/v1/collection/detail")
    fun loadCollectionDetailByIdAsync(@QueryMap(encoded = true) paramMap: Map<String, @JvmSuppressWildcards Any>): @JvmSuppressWildcards Deferred<BaseResponse<MineCollectionEntity>>

    // 获取账户列表
    @GET("/journey-work/api.admin/v1/account/list")
    fun loadAccountListAsync(@QueryMap(encoded = true) paramMap: Map<String, @JvmSuppressWildcards Any>): @JvmSuppressWildcards Deferred<BaseResponse<List<MineAccountEntity>>>


    /**
     * 获取Banner列表
     *
     * @return
     */
    @GET("api/v2/banners")
    fun loadBannerListDataAsync(): Deferred<GankIoResponse<List<BannerEntity>>>

    /**
     * 根据不同类型获取周最热内容
     * @param hotType 热度类型 views（浏览数） | likes（点赞数） | comments（评论数）
     * @param category Article | GanHuo | Girl 类型数据
     * @param count 数量
     */
    @GET("api/v2/hot/{hotType}/category/{category}/count/{count}")
    fun loadWeekHottestListAsync(
        @Path("hotType") hotType: String,
        @Path("category") category: String,
        @Path("count") count: Int
    ): Deferred<GankIoResponse<List<WeekHottestEntity>>>

    /**
     * 文章详情
     * @param id 文章id
     */
    @GET("api/v2/post/{id}")
    fun loadGankArticleDetailAsync(@Path("id") id: String): Deferred<GankIoResponse<GankArticleDetailEntity>>

    /**
     * 可搜索干货
     *
     */
    @GET("api/v2/search/{search}/category/All/type/{type}/page/{page}/count/20")
    fun loadGankSearchContentAsync(
        @Path("search") search: String,
        @Path("type") type: String,
        @Path("page") page: Int
    ): Deferred<GankIoResponse<List<SearchGankEntity>>>

    /**
     * 干货 - 美女
     */
    @GET(value = "api/v2/data/category/Girl/type/Girl/page/{page}/count/20")
    fun loadGankGirlListAsync(@Path("page") page: Int): Deferred<GankIoResponse<List<GankGirlEntity>>>

    /**
     * 干货 - 文章所有子分类
     */
    @GET(value = "api/v2/categories/GanHuo")
    fun loadGankIoMenuListAsync(): Deferred<GankIoResponse<List<GankMenuEntity>>>

    /**
     * 天气查询
     * @param city 城市
     */
    @GET("weather_mini")
    fun loadWeatherInfoAsync(@Query("city") city: String): Deferred<WeatherEntity>

    /**
     * 文章列表数据
     */
    @GET(value = "api/v2/data/category/GanHuo/type/{type}/page/{page}/count/20")
    fun loadGankIoArticleListAsync(
        @Path("type") type: String,
        @Path("page") page: Int
    ): Deferred<GankIoResponse<List<GankArticleEntity>>>

    /**
     * 首页- 发现列表
     */
/*    @GET(value = "api/v7/index/tab/discovery")
    fun loadHomeFoundListData(): Observable<BaoBaBaseResponse<List<HomeFoundEntity>>>*/

    /**
     * 首页 - 推荐列表
     */
    @GET(value = "api/v5/index/tab/allRec")
    fun loadHomeRecommendListDataAsync(@Query("page") page: Int): Deferred<BaoBaBaseResponse<List<HomeRecommendEntity>>>

    /**
     * 视频详情-推荐列表
     */
    @GET(value = "api/v4/video/related")
    fun loadVideoDetailRecommendListAsync(@Query("id") videoId: String): Deferred<BaoBaBaseResponse<List<HomeRecommendEntity>>>

    /*************************************** 网易视频列表 ****************************************/

    /**
     * 网易视频列表
     * @param id  ->V9LG4B3A0:热点  V9LG4CHOR->娱乐 V9LG4E6VR->搞笑 00850FRB->精品
     */
    @GET(value = "nc/video/list/{id}/n/{startPage}-10.html")
    fun loadNeteaseVideoListAsync(
        @Path("id") id: String,
        @Path("startPage") startPage: Int
    ): Deferred<NeteaseVideoEntity>

    /**
     * 网易新闻列表
     */
    @GET(value = "nc/article/{type}/{id}/{startPage}-20.html")
    fun loadNeteaseNewsListAsync(
        @Path("type") type: String,
        @Path("id") id: String,
        @Path("startPage") startPage: Int
    ): Deferred<HashMap<String, List<NeteaseNewsEntity>>>

    /**
     * 网易新闻详情
     */
    @GET(value = "nc/article/{id}/full.html")
    fun loadNeteaseNewsDetailAsync(@Path("id") id: String): Deferred<HashMap<String, NeteaseNewsDetailEntity>>

    /*************************************** 天行 ****************************************/

    /**
     * 天行-美女数据
     */
    @GET(value = "meinv/index")
    fun loadBeautyGirlWordListAsync(
        @Query("key") key: String,
        @Query("num") num: Int,
        @Query("page") page: Int,
        @Query("word") word: String
    ): Deferred<TianXingResponse<List<BeautyGirlEntity>>>

    /**
     * 天行-美女数据
     */
    @GET(value = "meinv/index")
    fun loadBeautyGirlListAsync(
        @Query("key") key: String,
        @Query("num") num: Int,
        @Query("page") page: Int
    ): Deferred<TianXingResponse<List<BeautyGirlEntity>>>


    /*************************************** 玩Android ****************************************/

    /**
     * banner数据
     */
    @GET(value = "banner/json")
    fun loadPlayAndroidBannerListAsync(): Deferred<PlayAndroidResponse<List<PlayAndroidBannerEntity>>>

    /**
     * 首页内容 -
     */
    @GET(value = "article/list/{page}/json")
    fun loadPlayAndroidHomeListAsync(@Path("page") page: Int): Deferred<PlayAndroidResponse<PlayAndroidHomeEntity>>

    /**
     * 项目目录列表
     */
    @GET(value = "project/tree/json")
    fun loadPlayAndroidMenuListAsync(): Deferred<PlayAndroidResponse<List<PlayAndroidMenuEntity>>>

    /**
     * 项目列表
     */
    @GET(value = "project/list/{page}/json")
    fun loadPlayAndroidListByIdAsync(
        @Path("page") page: Int,
        @Query("cid") cid: String
    ): Deferred<PlayAndroidResponse<PlayAndroidProjectEntity>>

}